<!DOCTYPE html>

<html>

	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
		<title>私人订制</title>
		<link rel="icon" type="image/x-icon" href="/images/favicon.ico">
		<link rel="stylesheet" href="/plugins/layui/css/layui.css" media="all" />
		<link rel="stylesheet" href="/css/login.css" />
	</head>

	<body class="beg-login-bg">
		<div class="app">
			<header>
				<h1>私人订制</h1>
			</header>
			<form>
				<div>
					<label>用户名:</label>
					<input v-model="username"/>
				</div>
				<div>
					<label>密  码:</label>
					<input type="password" v-model="password"/>
				</div>
				<div>
					<button @click="login()">登录</button>
				</div>
			</form>
			<footer>
				<p>私人订制 © www.dlwtm.cn</p>
			</footer>
		</div>
		<script src="/plugins/layui/layui.js"></script>
		<script src="/js/vue/vue.min.js"></script>
		<script src="/js/axios/axios.min.js"></script>
		<script type="text/javascript">
			new Vue({
				el:'#app',
				data: function () {
					return {
						user:{
						    username:'',
							password:''
						}
					}
                },
				methods:{
                    login:function () {
                        let url = '/doLogin';
                        let self = this;
                        console.log(self.user)
						axios.post(self.user,url).then(function (res) {
						    console.log(res)
							if (res.data.code == 0) {
                                axios.get("/index");
							}else {
                                axios.get("/login");
							}
                        })
                    }
				}
			})
		</script>
	</body>

</html>